package com.example.lifecycletest

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
    val TAG :String = "MainActivity"
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        startDialog.setOnClickListener { startActivity(Intent(this,DialogActivity::class.java)) }
        startNormal.setOnClickListener {
            startActivity(Intent(this,NormalActivity::class.java))
        }
        Log.e(TAG, "onCreate: Task id is $taskId")
        Log.e(TAG, "onCreate: Activity创建")
    }

    override fun onStart() {
        super.onStart()
        Log.e(TAG, "onStart: Activity开始")
    }

    override fun onResume() {
        super.onResume()
        Log.e(TAG, "onResume: Activity显示")
    }

    override fun onPause() {
        super.onPause()
        Log.e(TAG, "onPause: Activity暂停")
    }

    override fun onStop() {
        super.onStop()
        Log.e(TAG, "onStop: Activity停止")
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.e(TAG, "onDestroy: Activity销毁")
    }

    override fun onRestart() {
        super.onRestart()
        Log.e(TAG, "onRestart: Activity重启")
    }
}